<?php /*a:2:{s:73:"D:\leruge_program\local\admin\application\admin\view\system\add_menu.html";i:1592188951;s:71:"D:\leruge_program\local\admin\application\admin\view\common\__base.html";i:1592181449;}*/ ?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta http-equiv="Access-Control-Allow-Origin" content="*">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="/static/admin/lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="/static/admin/lib/font-awesome-4.7.0/css/font-awesome.min.css" media="all">
    <link rel="stylesheet" href="/static/admin/css/public.css" media="all">
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <style id="layuimini-bg-color">
    </style>
    
</head>
<body>
<div class="layuimini-container">
    <div class="layuimini-main">
        
<form class="layui-form layui-form-pane">
    <div class="layui-form-item">
        <label class="layui-form-label">上级菜单</label>
        <div class="layui-input-block">
            <select name="pid">
                <option value="">选择上级</option>
                <?php if(is_array($oneMenuList) || $oneMenuList instanceof \think\Collection || $oneMenuList instanceof \think\Paginator): $i = 0; $__LIST__ = $oneMenuList;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
                <option value="<?php echo htmlentities($vo['id']); ?>"><?php echo htmlentities($vo['title']); ?></option>
                <?php endforeach; endif; else: echo "" ;endif; ?>
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">菜单名称</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input" name="title" lay-verify="require" placeholder="菜单名称">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">菜单地址</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input" name="name" placeholder="菜单地址">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">选择图标</label>
        <div class="layui-input-block">
            <input type="text" name="icon" id="icon_picker" lay-filter="icon_picker" style="display: none;">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">排序</label>
        <div class="layui-input-block">
            <input type="number" class="layui-input" name="sort" value="9" placeholder="排序">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">显示|隐藏</label>
        <div class="layui-input-block">
            <input type="checkbox" name="is_show" value="1" lay-skin="switch" lay-text="显示|隐藏" checked>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="submit">添加</button>
        </div>
    </div>
</form>

    </div>
</div>

<script src="/static/admin/lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
<script src="/static/admin/js/lay-config.js?v=2.0.0" charset="utf-8"></script>

<script>
    layui.use(['form', 'element', 'iconPickerFa'], function () {
        let isClick = true,
            iconPickerFa = layui.iconPickerFa,
            form = layui.form,
            $ = layui.jquery;

        // 渲染选择图标
        iconPickerFa.render({
            elem: "#icon_picker",
            url: "/static/admin/lib/font-awesome-4.7.0/less/variables.less",
            search: true,
            page: true,
            limit: 12
        });

        // 提交
        form.on("submit(submit)", function () {
            if (isClick) {
                isClick = false;
                $.post("<?php echo url('admin/system/addMenu'); ?>", $("form").serialize(), function (res) {
                    if (res.code == 1) {
                        layer.msg(res.msg, function () {
                            parent.location.reload();
                        });
                    } else {
                        isClick = true;
                        layer.msg(res.msg);
                    }
                }, "json");
            } else {
                layer.msg("不允许重复提交");
            }
            return false;
        });
    });
</script>

</body>
</html>
